import os
import time

# 测试一个文件或目录是否存在
def demo_1():
    print(os.path.exists('../temp/not_exists.txt'))
    print(os.path.exists('../temp/test.txt'))
    print(os.path.isfile('../temp/test.txt'))
    print(os.path.isdir('../temp'))
    print(os.path.islink('../temp/tempfile.bin'))
    print(os.path.getsize('../temp'))
    print(os.path.getmtime('../temp'))
    print(time.ctime(os.path.getmtime('../temp')))

if __name__ == '__main__':
    demo_1()